package com.hrserviceserve.utils;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import org.springframework.stereotype.Component;

@Component
public class TokenUtils {
    final static String sign="alskdjalksjdaaaa";
    public static String getToken(String username){
        return JWT.create().withAudience(username).sign(Algorithm.HMAC256(sign));
    }
    public static String getUsername(String token){
        String username=JWT.decode(token).getAudience().get(0);
        return username;
    }
}
